﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace METU_CMT.Business
{
    public class Student : User
    {
        private DateTime expiryDate;
        //private List<Course> assignedCourses;

        public Student(int studentId)
        {
            UsersTableAdapter _usersTableAdapter = new UsersTableAdapter();
            expiryDate = _usersTableAdapter.GetExpiryDate(studentId);
            UserName = _usersTableAdapter.GetUserName(studentId);
            //assignedCourses = _usersTableAdapter.GetAssignedCoursesOfStudent(studentId);
            UserId = studentId;
            Name = _usersTableAdapter.GetName(studentId);
            Surname = _usersTableAdapter.GetSurname(studentId);
            Email = _usersTableAdapter.GetEMail(studentId);
            PhotoFile = _usersTableAdapter.GetPhotoFilePath(studentId);
        }

        public Student(string username, string surname, string name, DateTime expiryDate, string email)
        {
            //assignedCourses = new List< Course >();
            UserName = username;
            Name = name;
            Surname = surname;
            this.expiryDate = expiryDate;
            Email = email;
        }

        public Student()
        {
            //assignedCourses = new List<Course>();
            //TODO: Not Implemented
        }

        public DateTime ExpiryDate
        {
            get { return expiryDate; }
            set { expiryDate = value; }
        }


        public string ExpiryDateString
        {
            get { return expiryDate.ToString("dd.MM.yyyy"); }
        }

        //public List<Course> AssignedCourses
        //{
        //    get { return assignedCourses; }
        //    set { assignedCourses = value; }
        //}

        public override void GoToProfilePage( HttpResponse response )
        {
            response.Redirect("~/StudentProfileScreen.aspx");
        }

        public override void SetHome(MenuItem menuItem)
        {
            menuItem.NavigateUrl = "~/StudentProfileScreen.aspx";
        }


    }
}